Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep programming languages in memory #4376

Merged
merged 3 commits into from
Feb 2, 2023

Conversation

jorg-vr
Copy link
Contributor

@jorg-vr jorg-vr commented Feb 1, 2023

This pull request keeps programming languages in memory in a hash table. This greatly reduces the number of queries.

I considered a few different options to do this:

Adding includes(:programming_languages) statements

This would be relevant everywhere activity icons are displayed. This would reduce the numbers of queries by a lot already, but would still be similar to the amount of times activities are queried. This would still be a lot of queries for only 18 different programming languages.

using Memcached

This would replace database queries by memcached access. Because the queries themselves are small, most of the cost is due to the overhead of contacting a different server. This would not be solved by memcached.

Keeping an in memory hashmap

This is the option I chose. As there are only 18 different languages this won't take that much active memory. It reduces the number of queries to virtually zero.
The downside is the use of class variables in a multi threaded environment, that could be prone to timing related bugs.

@jorg-vr jorg-vr added the chore Repository/build/dependency maintenance label Feb 1, 2023
@jorg-vr jorg-vr self-assigned this Feb 1, 2023
@jorg-vr jorg-vr marked this pull request as ready for review February 1, 2023 10:19
@jorg-vr jorg-vr requested a review from a team as a code owner February 1, 2023 10:19
@jorg-vr jorg-vr requested review from bmesuere and niknetniko and removed request for a team February 1, 2023 10:19
@chvp chvp self-requested a review February 1, 2023 13:54
@jorg-vr jorg-vr merged commit 8e4a02c into develop Feb 2, 2023
@jorg-vr jorg-vr deleted the chore/limit-programing-language-query branch February 2, 2023 10:06
@bmesuere bmesuere added enhancement A change that isn't substantial enough to be called a feature and removed chore Repository/build/dependency maintenance labels Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A change that isn't substantial enough to be called a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants